package com.vic.designpattern.patterns.c_behavioral.iterator;

import java.util.List;

/**
 * @author victor
 */
public class StudentIteratorImpl implements StudentIterator {

    List<Student> list;
    int position = 0;

    public StudentIteratorImpl(List<Student> list) {
        this.list = list;
    }

    @Override
    public boolean hasNext() {
        return position < list.size();
    }

    @Override
    public Student next() {
        Student student = list.get(position);
        position++;
        return student;
    }
}
